package com.baizhi.service.impl;

import com.baizhi.dao.GuruDAO;
import com.baizhi.entity.Guru;
import com.baizhi.service.GuruService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class GuruServiceImpl implements GuruService {
    @Autowired
    private GuruDAO guruDAO;
    @Override
    @Transactional(readOnly = true)
    public PageInfo<Guru> selectAll(String nickName, Integer page, Integer limit) {
        PageHelper.startPage(page,limit);
        PageInfo info = new PageInfo(guruDAO.selectAll(nickName));
        return info;
    }

    @Override
    @Transactional
    public void insert(Guru g) {
        guruDAO.insert(g);
    }

    @Override
    @Transactional
    public void delete(Integer id, Integer status) {
        guruDAO.delete(id,status);
    }
}
